package com.gem.day06.extend2;

public class ShapeFactory {
	public static int RECT = 1;
	public static int CIRCLE = 2;
	public static int SQUARE = 3;

	public static Shape getShape(int type) {
		Shape shape = null;
		if (type == RECT) {
			shape = new Rect();
		} else if (type == CIRCLE) {
			shape = new Circle();
		} else if (type == SQUARE) {
			shape = new Square();
		} else {
			throw new RuntimeException("非法参数!");
		}
		return shape;
	}
}
